export default {
	fingerPrint() {
		return new Promise((resolve, reject) => {
			uni.checkIsSupportSoterAuthentication({
				fail(err) {
					reject(err);
				},
				success(res) {
					if (res.supportMode.includes("fingerPrint")) {
						uni.checkIsSoterEnrolledInDevice({
							checkAuthMode: 'fingerPrint',
							success(res) {
								uni.startSoterAuthentication({
									requestAuthModes: ['fingerPrint'],
									challenge: '123456',
									authContent: '请用指纹解锁',
									success(res) {
										resolve(res);
									},
									fail(err) {
										reject(err);
									},
								})
							},
							fail(err) {
								reject("请录制手机指纹")
							},
						})
					} else if (res.supportMode.includes("facial")) {
						uni.checkIsSoterEnrolledInDevice({
							checkAuthMode: 'facial',
							success(res) {
								uni.startSoterAuthentication({
									requestAuthModes: ['facial'],
									challenge: '123456',
									authContent: '请用FaceID解锁',
									success(res) {
										resolve(res);
									},
									fail(err) {
										reject(err);
									},
								})
							},
							fail(err) {
								reject("请录制手机面容")
							},
						})
					}else{
						resolve("请录制手机指纹");
					}
				},
			})
		})
	}
}
